﻿package com.wxsoft.business.sys.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.wxsoft.business.model.easyui.PageHelper;
import com.wxsoft.business.sys.dao.ISysRolesDao;
import com.wxsoft.business.sys.pojo.SysRoles;
import com.wxsoft.business.sys.pojo.SysUserRoles;
import com.wxsoft.business.sys.service.ISysRolesService;

@Service("sysRolesService")
public class SysRolesServiceImpl implements ISysRolesService  {
	@Resource
	private ISysRolesDao dao;
	
	
	public long findCount(SysRoles sysRoles) {
		return dao.findCount(sysRoles);
	}
	
	public List<SysRoles> findAll(PageHelper page,SysRoles sysRoles) {
        List<SysRoles> r = dao.findAll(page,sysRoles);
		return r;
	}
	@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
	public String add(SysRoles sysRoles) {
		this.dao.insert(sysRoles);
		return "操作成功!";
	}
	
	public String modify(SysRoles sysRoles) {
		this.dao.modify(sysRoles);
		return "操作成功!";
	}
	
	public String delete(SysRoles sysRoles) {
		this.dao.delete(sysRoles);
		return "操作成功!";
	}

	@Override
	public List<SysRoles> getRoleBy(SysRoles sysRoles) {
		List<SysRoles> r = dao.getRoleBy(sysRoles);
		return r;
	}

	public List<SysRoles> getRoleByUser(SysUserRoles userRoles){
		List<SysRoles> r = dao.getRoleByUser(userRoles);
		return r;
	}
}
